<?php
    $customerid = $_SESSION['customerid'];

    switch ($change_old)
        {
            case 'Deutsch':$sql6= "update settings set can='Deutsch', cande='Deutsch', canen='German', canes='Alemán', canru='Немецкий' where customerid = ". $customerid;break;
            case 'Englisch':$sql6= "update settings set can='Englisch', cande='Englisch', canen='English', canes='Inglés', canru='Английский' where customerid = ". $customerid;break;
            case 'Spanisch':$sql6= "update settings set can='Spanisch', cande='Spanisch', canen='Spanish', canes='Español', canru='Испанский' where customerid = ". $customerid;break;
            case 'Russisch':$sql6= "update settings set can='Russisch', cande='Russisch', canen='Russian', canes='Ruso', canru='Русский' where customerid = ". $customerid;
        }

    $db_sel6 = mysql_query( $sql6 );
    if ( ! $db_sel6 ) { die('Error query5: ' . mysql_error()); }

    // check, if oldlanguage = newlanguage
	$sql8 = " select learnde from settings ";
    $sql8 .= " where customerid = ". $customerid;
    $db_sel8 = mysql_query( $sql8 );
    if ( ! $db_sel8 ) { die('Error query8: ' . mysql_error()); }
    while ($row = mysql_fetch_array( $db_sel8, MYSQL_ASSOC)) {
    $learn = $row['learnde'];
    if ( $row['learnde'] == $change_old )
    {
        $learn = '-';
        // update language can
	    $sql10 = " update settings set ";
        $sql10 .= " learn = '-', learnde = '-', learnen = '-', learnes = '-', learnru = '-', langpair = '' ";
        $sql10 .= " where customerid = ". $customerid;
        $db_sel10 = mysql_query( $sql10 );
        if ( ! $db_sel10 ) { die('Error query10: ' . mysql_error()); }
    }
    }

    // update langpair
	$sql11 = " select langpairid from langpairs_german ";
    $sql11 .= " where learn = '". $learn . "' and can = '". $change_old . "' ";
    $db_sel11 = mysql_query( $sql11 );
    if ( ! $db_sel11 ) { die('Error query11: ' . mysql_error()); }
    while ($row = mysql_fetch_array( $db_sel11, MYSQL_ASSOC)) {

	$sql12 = " update settings set ";
    $sql12 .= " langpair = ". $row['langpairid'];
    $sql12 .= " where customerid = ". $customerid;

    $db_sel12 = mysql_query( $sql12 );
    if ( ! $db_sel12 ) { die('Error query4: ' . mysql_error()); }
    $_SESSION['langpair'] = $row['langpairid'];
    }







?>